<?php
include_once $_SERVER['DOCUMENT_ROOT'].'/phorm/model/fields/UnixTimestamp.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/phorm/database/core/IInsertOnlyColumn.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/phorm/database/core/IAutoUpdateColumn.php';

class CreationTimestamp extends UnixTimestamp implements IInsertOnlyColumn
{	
	public function __construct(IDatabaseRecord &$object, $defaultValue = 'now')
	{
		parent::__construct($object, $defaultValue);
	}

	public function insert()
	{
		if (!$this->data)
			$this->data = array('value'=>'');
		
		$this->data['value'] = time();
	}
}
?>
